Skip to content

fix(validation): expand validate_url edge case coverage#180

Open
HitanshiThakar wants to merge 3 commits into
utksh1:mainfrom
HitanshiThakar:test/url-validation-coverage
Open

fix(validation): expand validate_url edge case coverage#180
HitanshiThakar wants to merge 3 commits into
utksh1:mainfrom
HitanshiThakar:test/url-validation-coverage

Conversation

@HitanshiThakar
Copy link
Copy Markdown

Description

Added additional validate_url test coverage in testing/backend/unit/test_validation.py for edge cases including:

localhost URLs with paths and query parameters
IP addresses with ports
invalid schemes
missing hosts
malformed ports
URLs containing spaces

While adding the tests, I found that malformed/out-of-range ports were being accepted as valid URLs. Added a small validation fix to reject invalid port values.

Related Issues

Closes #80

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

How Has This Been Tested?

python -m pytest testing/backend/unit/test_validation.py -v

Result:

6 tests passed

Checklist

  • My code follows the code style of this project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.

Copy link
Copy Markdown
Owner

@utksh1 utksh1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI currently shows backend-tests failing. Please rebase on latest main and re-run CI; if failures persist, fix them.

After checks are green, I can re-review the URL validation coverage changes.

@utksh1 utksh1 added area:backend Backend API, database, or service work area:plugins Scanner plugin metadata, schemas, or plugin runtime work type:testing Testing work category bonus label type:bug Bug fix work category bonus label level:intermediate 35 pts difficulty label for moderate contributor PRs labels May 22, 2026
@HitanshiThakar
Copy link
Copy Markdown
Author

Done, All checks have passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:backend Backend API, database, or service work area:plugins Scanner plugin metadata, schemas, or plugin runtime work level:intermediate 35 pts difficulty label for moderate contributor PRs type:bug Bug fix work category bonus label type:testing Testing work category bonus label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BEGINNER FRIENDLY] Add backend unit tests for validate_url edge cases

2 participants